package com.peking.donations.base.service;


import com.peking.donations.base.security.LoggedUser;
import com.peking.donations.base.util.SecurityUtil;

/**
 * 涓氬姟灞俢hecked寮傚父鍩虹被
 * 閫氬父鎯呭喌涓嬶紝鎴戜滑鍦ㄤ笟鍔￠�昏緫涓姏鍑簎nchecked寮傚父鑰屼笉鏄痗hecked寮傚父锛屼互閬垮厤api鎺ュ彛涓ぇ閲忕殑throws澹版槑銆�
 * 浣嗗鏋滅壒鍒渶瑕乮nvoker澶勭悊鐨勮瘽锛岃繕鏄娇鐢˙izException涓哄疁銆�
 * 
 * @author hawk
 *
 */
public class BizServiceException extends Exception {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5305264686660945067L;

	public BizServiceException(String msg) {
		super(msg+getInfo());
	}
	
	public BizServiceException(String msg, Throwable e) {
		super(msg+getInfo(), e);
	}
	
	 private static String getInfo(){
	    	LoggedUser user = SecurityUtil.getCurrentUser();
	    	if(user==null){
	    		return "[匿名用户 ]";
	    	}else{
	    		return " [userId=" + user.getUserId() + ", openId=" + user.getOpenId()
				+ ", username=" + user.getUsername() + "]";
	    	}
	    		
	    }
}
